home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1576 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.1 KB

  1. Path: news.bridge.net!news
  2. From: David Byrden <100101.2547@compuserve.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Random numbers
  5. Date: 11 Jan 1996 19:06:22 GMT
  6. Organization: self-employed
  7. Message-ID: <4d3n3e$d9m@news.bridge.net>
  8. References: <4cul2d$gi@news.ran.es>
  9. NNTP-Posting-Host: ppp-mia1-65.bridge.net
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (Windows; I; 16bit)
  14.  
  15.  
  16. Martin;
  17.  
  18. The rand() function is defined to return an int. If the ints in
  19. your compiler are 16 bits, we can immediately say that the
  20. maximum number of unique random numbers available to you is
  21. 65536.
  22.  
  23. Even if you have 32-bit random numbers, there are many different
  24. statistical characteristics of randomness which a particular
  25. rand() function may or may not support well enough. Are the numbers
  26. evenly distributed, do they generate equal power throughout the
  27. frequency spectrum, etc etc.
  28.  
  29. If you need a better random number generator, or just one with more
  30. bits, it's time to haul out a book on numerical algorithms and write one. 
  31. They are surprisingly small once you have themfigured out.
  32.  
  33.    David
  34.  
  35.  
  36.  
  37.  
  38.